url = '/:slug|sendorderemail-\d+.html$'
description = '订单发送邮件'
is_hidden = 0
layout = 'default'
[session]
security = "user"
redirect = "account/login"
==
use Jason\Ccshop\Controllers\Orders;
function onStart() {
    header("Content-type: text/html; charset=utf-8");
    $userid_login = $this['user']['attributes']['id'];

    $slugArr = explode('-', str_replace('.html', '', $this->param('slug')));
    $sn = $slugArr['1'];
    $order = (new Orders())->orderDetail($sn);
    $userid_order = $order['attributes']['uid'];
    if($order == null){
        return redirect('/account/login.html');
    }
    if($userid_order != $userid_login){
        return redirect('/account/login.html');
    }
    $this['email'] = $this['user']['attributes']['email'];
    $this['orderStatusCode'] = $order->order_status->code;
    $this['order'] = $order;
    $this['previousUrl'] = Url::previous();
}
==
<div class="content">
        <div class="title-return">
            <h2>メールアドレス</h2>
            <a href="javascript:;" onclick="history.go(-1);return false;"><img src="{{ 'assets/img/btn_back.gif'|theme}}" alt="戻る"></a>
        </div>
        <div class="registe">
            {{ form_ajax('onSendOrderEmail', { class: 'form-horizontal', redirect:previousUrl }) }}
            <input type="hidden"  name="sn" value="{{ order.sn ? order.sn : '' }}" />
            <table>
                <tr>
                    <th>メールアドレス</th>
                    <td><input class="loginInput" style="border-color: #ddd" name="email" value="{{ email }}"  type="text" required placeholder=""></td>
                </tr>
                <tr>
                    <th>タイトル</th>
                    <td><input class="loginInput" style="border-color: #ddd" name="title" value="" maxlength="255" type="text" required placeholder="メールアドレス"></td>
                </tr>
                <tr>
                    <th>コンテンツ</th>
                    <td><textarea style="height:200px;padding: 5px;" name="content" maxlength="65535" value="" required placeholder="お問い合わせしたい内容を入力してください"></textarea></td>
                </tr>
            </table>
            <div class="btn-agree" style="text-align: center;">
                <button type="submit" class="btn-submit pay_btn" style="width: 200px; display: inline-block; margin-bottom: 10px;">送信する</button>
            </div>
            {{ form_close() }}
        </div>
</div>